Notations and Priority Matching for Dial Plan Patterns

The notations that you can use for configuring the 'Prefix field in the Dial Plan Rule table are described in the table below. As this field is used in the Dial Plan to match a number pattern (source or destination) based on prefix, suffix or entire number, the notations are relevant to both prefix and suffix of the number (unless explicitly stated otherwise).

Notation

Description

0-9

Specific digit.

a-z

Lower-case letter.

Note: Dial Plan matching is case-sensitive.

A-Z

Upper-case letter.

Note: Dial Plan matching is case-sensitive.

x

Wildcard (metacharacter) that represents any single digit from 0 through 9.

Note:

The wildcard is case-insensitive.
To represent the character "x", precede it with the escape "\" character. For example, to represent an upper-case "X", use this syntax: \X

z

Wildcard (metacharacter) that represents any single digit from 1 through 9.

Note:

The wildcard is case-insensitive.
To represent the character "z", precede it with the escape "\" character. For example, to represent a lower-case "z", use this syntax: \z

n

Wildcard (metacharacter) that represents  any single digit from 2 through 9.

Note:

The wildcard is case-insensitive.
To represent the character "n", precede it with the escape "\" character. For example, to represent an upper-case "N", use this syntax: \N

.

(Dot) Wildcard (metacharacter) that represents any single character (letter, digit or symbol).

To represent the dot "." character itself, precede it with the escape "\" character (see below).

*

(Asterisk symbol) If it is the only character in the rule, it functions as a wildcard (metacharacter) that represents any amount of digits or letters (i.e., matches everything).

To represent the asterisk "*" symbol itself, precede it with the escape "\" character (see below).

Note: You can’t use a non-escaped * as part of the rule. For example, the following are invalid rules: “333*” or “192\.168\.0\.*”  

\

(Backslash escape character) When it prefixes the wildcard character “n”, “x”, “z”, or “.”, the character is escaped and used literally instead of the wildcard function.

For example, “10\.255\.255\.x” represents the IP address 10.255.255.[0-9]. As each dot (.) is prefixed by a backslash, the device considers these dots as the "." character (and not the . wildcard). In addition, as the “x” at the end of the value is not prefixed by a backslash, the device considers it the x wildcard.

#

(Pound or hash symbol) When used at the end of the prefix, it represents the end of the number.

Examples:

54324#: Represents the 5-digit number “54324”.
192\.168\.1\.[1-9]# and 192\.168\.1\.[01-96]#: Represent IP addresses 192.168.1.1 to 192.168.1.96

[n1-m1,n2-m2,a,b,c,...]

Represents a range of numbers for the prefix. The range can include both contiguous numbers and standalone numbers.

Examples:

[123-130]: Represents a prefix number “123” through “130”.
[123-130,455,766,780-790]: Represents a prefix number from “123” through “130”, “455”, “766”, or “780” through 790”.
[123,125,130]: Represents a prefix number “123”, “125”, or “130”.

Note:

The range (number ranges and single numbers) must contain the same amount of digits, as shown in the examples above where the number ranges and single numbers all contain three digits.
The device matches the numbers in the range and not the individual digits that make up the numbers. For example, if the rule’s pattern is “[001-130]”, the device matches strings such as “002”, “012”, “129” or “1001”; it doesn’t match strings “2”, “12”, “301” or “0002”.
You can’t use an empty range (e.g., "+91[]").
Ranges can contain only digits (i.e., letters are not allowed).
The mixed notation can be configured with up to 19 digits, for example,  “[1234567891234567890,1234567891234567891]”.
The range (start and end) cannot be greater than 2,147,483,647, as in the example (which is invalid) “[20000000001-40000000001]”.

([…])

Represents a range of numbers for the suffix.

The range can include both contiguous numbers and standalone numbers.

Examples:

([123-130]): Represents a suffix number “123” through “130”.
([123-130,455,766,780-790]): Represents a suffix number from “123” through “130”, “455”, “766”, or “780” through “790”.
[123,125,130]: Represents a suffix number “123”, “125”, or “130”.

Note:

The range (number ranges and single numbers) must contain the same amount of digits, as shown in the examples above where the number ranges and single numbers all contain three digits.
The device matches the numbers in the range and not the individual digits that make up the numbers. For example, if the rule’s pattern is “([001-130])”, the device matches strings such as “002”, “012”, “129” or “9129”; it doesn’t match strings “2”, “12”, “302” or “0200”.
You can’t use an empty suffix range (e.g., "+91([])").
Ranges can contain only digits (i.e., letters are not allowed).
The mixed notation can be configured with up to 19 digits, for example, “([1234567891234567890,1234567891234567891])”.
The range (start and end) cannot be greater than 2,147,483,647, as in the example (which is invalid) “([20000000001-40000000001])”.

(…)

Represents a specific suffix, which can contain digits and letters.

Examples:

[123-130](456): represent a number whose prefix number is “123” through “130” and whose suffix is “456”.
123(UK): represent a number whose prefix number is “123” and whose suffix is “UK”.

Note: You can’t use an empty suffix (e.g., "+91()”).

The device employs a "best-match" method instead of a "first-match" method to match the source/destination numbers to prefixes configured in the Dial Plan. The matching order is done digit-by-digit and from left to right.

The best match priority is listed below in chronological order:

1. Specific prefix
2. "x" wildcard, which denotes any digit (0 through 9)
3. Number range
4. "n" wildcard, which denotes a number from 2 through 9
5. "z" wildcard, which denotes a number from 1 through 9
6. Suffix, where the longest digits is first matched, for example, ([001-999]) takes precedence over ([01-99]) which takes precedence over ([1-9])
7. "." (dot), which denotes any single character

For example, the following table shows best matching priority for an incoming call with prefix number "5234":

Dial Plan Best Match Priority

Dial Plan Prefix

Best Match Priority (Where 1 is Highest)

5234

1

523x

2

523[2-6]

3

523n

4

523z

5

523(4)

6

523.

7

When number ranges are used in Dial Plan rules (comma-separated standalone numbers or hyphenated range), best match priority is as follows:

Dial Plan rules with ranges of multiple standalone numbers: The device chooses the matching rule in the Dial Plan Rule table that has the lowest row index number (i.e., listed higher up in the table). For example, if the prefix number of an incoming call is "110" and you have configured the below rules, the device chooses Index #0 because it has the lowest row index number (even though more numbers match the incoming call prefix number).

Index

Prefix

0

[1,3,5]

1

[110,120]

Dial Plan rules with ranges of contiguous numbers and the amount of possible matched numbers is identical: The device chooses the matching rule in the Dial Plan Rule table that has the lowest row index number (i.e., listed higher up in the table). For example, if the prefix number of an incoming call is "110" and you have configured the below rules (each rule has a range of 3 possible matching numbers), the device chooses Index #0 because it has the lowest row index number (even though more numbers match the incoming call prefix number).

Index

Prefix

0

[1-3]

1

[10-12]

Dial Plan rules with ranges of contiguous number and the amount of possible matched numbers is different: The device chooses the matching rule in the Dial Plan Rule table that has the least amount of numbers. For example, if the prefix number of an incoming call is "110" and you have configured the below rules (Index #0 with 7 possible matched numbers and Index #1 with 3 possible matched numbers), the device chooses Index #1 because it has less numbers.

Index

Prefix

0

[1-7]

1

[10-12]

Dial Plan rules with ranges of contiguous number and multiple standalone numbers: The device chooses the matching rule in the Dial Plan Rule table that has the standalone number range (not contiguous range). For example, if the prefix number of an incoming call is "110" and you have configured the below rules (Index #0 is a standalone number range and Index #1 a contiguous range), the device chooses Index #0 because it is the standalone number range.

Index

Prefix

0

[1,2,3,4,5]

1

[1-3]

Additional examples of best match priority for Dial Plan rules configured with a specific number and optionally followed by the "x" notation or prefix or suffix range are shown below:

For incoming calls with prefix number "5234", the rule with tag B is chosen (more specific for digit "4"):

Index

Prefix

Tag

0

523x

A

1

5234

B

For incoming calls with prefix number "5234", the rule with tag A is chosen (see matching priority above):

Index

Prefix

Tag

0

523x

A

1

523[1-9]

B

For incoming calls with prefix number "53211111", the rule with tag B is chosen (more specific for fourth digit):

Index

Prefix

Tag

0

532[1-9]1111

A

1

5321

B

For incoming calls with prefix number "53124", the rule with tag B is chosen (more specific for digit "1"):

Index

Prefix

Tag

0

53([2-4])

A

1

531(4)

B

For incoming calls with prefix number "321444", the rule with tag A is chosen and for incoming calls with prefix number "32144", the rule with tag B is chosen:

Index

Prefix

Tag

0

321xxx

A

1

321

B

For incoming calls with prefix number "5324", the rule with tag B is chosen (prefix is more specific for digit "4"):

Index

Prefix

Tag

0

532[1-9]

A

1

532[2-4]

B

For incoming calls with prefix number "53124", the rule with tag C is chosen (longest suffix - C has three digits, B two digits and A one digit):

Index

Prefix

Tag

0

53([2-4])

A

1

53([01-99])

B

2

53([001-999])

C

For incoming calls with prefix number "53124", the rule with tag B is chosen (suffix is more specific for digit "4"):

Index

Prefix

Tag

0

53([2-4])

A

1

53(4)

B